package view;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;

import model.Paper;

/**
 * Class to open a paper.
 * @author Sarah George
 * @version Autumn 2012
 */
@SuppressWarnings("serial")
public class OpenPaperAction extends AbstractAction {

	/**
	 * Field to hold the paper to be opened.
	 */
	private Paper paper;

	/**
	 * Constructor for an open paper action.
	 * @param the_paper the paper to be opened.
	 */
	public OpenPaperAction(Paper the_paper) {
		super("Open");
		putValue(Action.MNEMONIC_KEY, KeyEvent.VK_O);
		putValue(Action.SELECTED_KEY, true);
		paper = the_paper;
	}

	/**
	 * Method to open a manuscript.
	 * @param arg0 the action event that triggers the method.
	 */
	@Override
	public void actionPerformed(ActionEvent arg0) {
		paper.open();
	}
}//End class open paper action.